/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.myapp.struts;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author Vinu
 */
public class Panier {
    
    List<Film> films ;
    int numero;
   float prix;

    
      public Panier() {
          films = new ArrayList<Film>();
          
         
      }
      
      
    public List<Film> getFilms() {
        return films;
    }

    public void setFilms(List<Film> films) {
        this.films = films;
    }

    public int getNumero() {
        return numero;
    }

    public void setNumero(int numero) {
        this.numero = numero;
    }

    public float getPrix() {
        
            return prix;
    }
    
    public void deleteFilm(String nom)
    { int i=0;
        while(!(films.get(i).getNom().equalsIgnoreCase(nom)))
        {i++;
        }
        float price =films.get(i).getPrix();
        setPrix(this.prix - price) ;
        films.remove(i);       
    }
   
    public int size(){
    
        return films.size();
    
    
    }
           
            
            
    public void setPrix(float prix) {
        this.prix = prix;
    }
    

  
    
    public void addfilm(Film flm){
    films.add(flm); 
     
        prix += flm.getPrix();
        
        
    
    }
    
    
    public void delete()
    {
       films.clear();
    this.numero=-1;
    this.prix=0;
    
    
    }
    
    
}
